package com.wx.bootsecurity.controller;

import io.swagger.annotations.Api;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: aerfazhe
 * @Date: 2021/7/17 16:02
 * @Statement: 跳转页面
 */
@Api(tags = "页面跳转Controller")
@Controller
public class ForworkHtmlController {

    /**
     * 跳转到登录页面
     * @return
     */
    @GetMapping("/showLogin")
    public String toFirstHtml() {
        return "login";
    }

    @PostMapping("/main")
    public String firstMain() {
        return "main";
    }

    @GetMapping("/success")
    @PreAuthorize("hasAnyRole('商品分类管理员','品牌管理员')")
    @ResponseBody
    public String success() {
        return "Success";
    }

    @PostMapping("/toError")
    public String toError() {
        return "error";
    }

    @GetMapping("/demo")
    public String demo() {
        return "demo";
    }

}
